package com.example.administrator.js_bank;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends AppCompatActivity {
        Button button1;
        EditText mEtUsername,mEtPassword;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        button1=findViewById(R.id.bt_login);
        mEtUsername=findViewById(R.id.et_username);
        mEtPassword=findViewById(R.id.et_password);

        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String username = mEtUsername.getText().toString();
                String password = mEtPassword.getText().toString();
                if (username.equals("00000") && password.equals("123")){
                    init();
                }else {

                    Toast.makeText(LoginActivity.this, "账号或密码错误！", Toast.LENGTH_LONG).show();

                }

            }
        });
    }

    private void init() {
        Intent intent=new Intent(this, MainActivity.class);
                 startActivity(intent);
    }


}

